#ifndef unigame_Component_h
#define unigame_Component_h

#include "config/Def.h"
#include "object/AutoRelease.h"

namespace unigame
{
	enum ComponentType
	{
		E_NONT_CT,
		E_MESH_CT,
		E_MATERIAL_CT,
		E_LUA_CT,
	};

	class Component: public AutoRelease
	{
	public:
		Component(int32u type):AutoRelease(), m_type(type), m_isEnable(true){}
		virtual ~Component(){}

		virtual void update(){}
	
		Component* next()
		{
			return m_next;
		}

		void next(Component* next)
		{
			m_next = next;
		}

		int32u type()
		{
			return m_type;
		}

		void enable(bool isEnable)
		{
			m_isEnable = isEnable;
		}

		bool enable()
		{
			return m_isEnable;
		}

	private:
		void tick()
		{
			if(m_isEnable)
			{
				update();
			}
		}

	private:
		Component* m_next;
		int32u m_type;
		bool m_isEnable;
	};
}

#endif